home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / progs / demo / X11 / graphics / manual < prev    next >
Encoding:
IslandWrite document  |  1994-09-27  |  18.2 KB  |  367 lines  |  [TEXT/ttxt]

  1. 104 pgscriptver 
  2.  
  3. 100 DefSpaceEx 100 DefCharEx 1 DefNormalHyphenationOn 100 
  4. DefTypeColor (Times-Roman) DefTypeFace ENGLISH DefLanguage 12 DefPointSize 
  5. USE_POINTSIZE DefSetSize (@default) DefTypeResource 
  6.  
  7. LEFT DefJustifyFlags 2 DefBeginParaLeadValue ABSOLUTE DefBeginParaLeadMode 2 
  8. DefEndParaLeadValue ABSOLUTE DefEndParaLeadMode 120 DefLeadValue 
  9. PROPORTIONAL DefLeadMode 1 46 0 TAB_LEFT  720 DefTab 1 46 0 
  10. TAB_LEFT  2160 DefTab 1 46 0 TAB_LEFT  3600 DefTab 1 46 0 
  11. TAB_LEFT  5040 DefTab 1 46 0 TAB_LEFT  64he y-axis<e
  12. op>
  13.         | Beside Float Picture Float Picture  - two pictures placed side by sid
  14. e <eop>
  15.                                               - in accordance to the ratio of t
  16. he<eop>
  17.                                               - two floats<eop>
  18.         | Above Float Picture Float Picture   - two pictures placed one on top 
  19. of<eop>
  20.                                               - another in accordance to the ra
  21. tio<eop>
  22.                                               - of the two floats<eop>
  23.         | Rot Picture                         - picture is rotated 90 degrees <
  24. eop>
  25.                                               - counterclockwise<eop>
  26.         | File String                         - picture is stored as an externa
  27. l<eop>
  28.                                               - file<eop>
  29.         | Overlay Picture Picture             - two pictures are drawn such tha
  30. t<eop>
  31.                                               - one lays on top of the other<eo
  32. p>
  33.         | Grid Int Int SegList                - picture type that contains the 
  34. list<eop>
  35.                                               - of picture's line segments alon
  36. g<eop>
  37.                                               - with the size of the inital pic
  38. ture<eop>
  39. <eop>
  40. The type synonyms are pretty much self explanatory.<eop>
  41. <eop>
  42.         Hostname<tab><tab><tab>- a string of the hostname<eop>
  43.         Filename                              <tab>- a string of the filename<e
  44. op>
  45.         IntPoint                              <tab>- a tuple of integers repres
  46. enting<eop>
  47.                                               <tab>- the coordinates of a point
  48. <eop>
  49.         IntSegment                            <tab>- a tuple of Intpoints repre
  50. senting<eop>
  51.                                               <tab>- the endpoints of a line se
  52. gment<eop>
  53.         IntSegList                            <tab>- a list of IntSegments <eop
  54. >
  55.         Point                                 <tab>- same as IntPoint except in
  56.  place of<eop>
  57. <tab><tab><tab>             <tab>- intergers, they are floating points<eop>
  58.         Segment                               <tab>- same as IntSegment except 
  59. in place<eop>
  60.        <tab><tab>            <tab>- of intergers, they are floating <eop>
  61.          <tab><tab><tab>- points<eop>
  62.         SegList                               <tab>- same as IntsegList except 
  63. in place<eop>
  64.       <tab><tab><tab><tab>- of intergers, they are floating <eop>
  65.          <tab><tab><tab>- points<eop>
  66.         Vector                                <tab>- a tuple of floating points
  67.  to<eop>
  68.         <tab><tab><tab>- to represent a vector<eop>
  69.         Vtriple                               - a 3-tuple of Vectors<eop>
  70.         HendQuartet                           - a 4-tuple of Integers for the s
  71. ize<eop>
  72.                                               - of the Henderson window<eop>
  73.         PEnv                                  - a tuple of a Filename and a Pic
  74. ture<eop>
  75.                                               - for storing already opened file
  76. s in<eop>
  77.                                               - in order to save time and memor
  78. y<eop>
  79.                                               - when a file needs to be opened 
  80. more<eop>
  81.                                               - than once<eop>
  82. <eop>
  83. -------------------------------------------------------------------------------
  84. ----<eop>
  85. Function: create (an exported function from the HendersonLib)<eop>
  86. <eop>
  87. The purpose of the create function is to provide the user with a function to <e
  88. op>
  89. draw a picture from a graphics interface.  The user may choose to create a pict
  90. ure<eop>
  91. file by inputing the the lines and points manually into a file or (s)he may cho
  92. ose<eop>
  93. to use the create function.<eop>
  94. <eop>
  95. Functionality of create:<eop>
  96.            create :: Hostname -<ra> Filaname -<ra> Int -<ra> Int -<ra> IO()<eop
  97. >
  98. <eop>
  99. create takes as input a hostname, a filename, and two integers for the size of 
  100. the <eop>
  101. window to be opened.  Two windows should appear, one for the input of lines and
  102. <eop>
  103. another showing the current position of the mouse.  These windows will be label
  104. ed<eop>
  105. accordingly.<eop>
  106. To draw a line on the file window, move the cursor to the desired position, the
  107. n<eop>
  108. hit any key on the keybroad. This point will be the beginning of the line segme
  109. nt.<eop>
  110. Next move the cursor to the position of where the user wants the end of the lin
  111. e<eop>
  112. segment to be, then hit any key from the keyboard again.  A line should appear.
  113. <eop>
  114. The coordinates of the endpoints of each line drawn  will also be printed out o
  115. nto <eop>
  116. standard output.<eop>
  117. To signal completion of a file, press any button on the mouse.  The user must <
  118. eop>
  119. remember though that this is only applicable after a completed drawing of a lin
  120. e.<eop>
  121. For example, pressing the mouse button will not work if one of the endpoints of
  122.  a<eop>
  123. line is drawn but the other endpoint is not. create will not recognize the mous
  124. e <eop>
  125. button press event until a second endpoint is drawn.<eop>
  126. <eop>
  127. Advantages of create:<eop>
  128.  provides a quick and fun way to create a picture file.<eop>
  129. <eop>
  130. Disadvantages of create:<eop>
  131.  If the file does not exist, create will create the file and then store the pic
  132. ture<eop>
  133.  to it.  However, if the file exists, create will automatically delete the cont
  134. ents<eop>
  135.  of that file before storing the new picture.<eop>
  136. <eop>
  137. -------------------------------------------------------------------------------
  138. ----<eop>
  139. Function: modify (an exported function from the HendersonLib)<eop>
  140. <eop>
  141. The purpose of the modify function is to provide the user with a function make 
  142. <eop>
  143. additions to an already existing picture file using a graphics interface.  The 
  144. user<eop>
  145. may choose to modify the picture file by adding the the lines and points manual
  146. ly <eop>
  147. into the file or (s)he may choose to use the modify function.<eop>
  148. <eop>
  149. Functionality of modify:<eop>
  150.            modify :: Hostname -<ra> Filaname -<ra> IO()<eop>
  151. <eop>
  152. modify takes as input a hostname and a filename. Tow windows should appear.  Th
  153. e <eop>
  154. size of the draw window will be the same as the x and y coordinates already in 
  155. the<eop>
  156. file. These windows will be labeled accordingly.  The existing picture will app
  157. ear<eop>
  158. first before any input is allowed.<eop>
  159. To draw a line on the file window, move the cursor to the desired position, the
  160. n<eop>
  161. hit any key on the keybroad. This point will be the beginning of the line segme
  162. nt.<eop>
  163. Next move the cursor to the position of where the user wants the end of the lin
  164. e<eop>
  165. segment to be, then hit any key from the keyboard again.  A line should appear.
  166. <eop>
  167. The coordinates of the endpoints of each line drawn  will also be printed out o
  168. nto <eop>
  169. standard output.<eop>
  170. To signal completion of a file, press any button on the mouse.  The user must <
  171. eop>
  172. remember though that this is only applicable after a completed drawing of a lin
  173. e.<eop>
  174. For example, pressing the mouse button will not work if one of the endpoints of
  175.  a<eop>
  176. line is drawn but the other endpoint is not.  modify will not recognize the mou
  177. se <eop>
  178. button press event until a second endpoint is drawn.<eop>
  179. <eop>
  180. Advantages of modify:<eop>
  181.  provides a quick and fun way to modify a picture file without having to go int
  182. o<eop>
  183.  the file and manually add on the coordinates of the additional lines<eop>
  184. <eop>
  185. Disadvantages of modify:<eop>
  186.  Existing lines can not be deleted and any additional lines, whether intentiona
  187. l or<eop>
  188.  unintentional, will be appended to the picture and stored in the file.<eop>
  189. <eop>
  190. --------------------------------------------------------<eop>
  191. Function: sendToDraw<eop>
  192. <eop>
  193. Type of sendToDraw:<eop>
  194.   sendToDraw :: XWindow -<ra> XScreen -<ra> XDisplay -<ra> <eop>
  195.               XPixel -<ra> XPixel -<ra> Plot -<ra> IO()<eop>
  196. <eop>
  197. Usage:<eop>
  198.   sendToDraw win scn dis fg_color bg_color plt<eop>
  199. <eop>
  200. 'sendToDraw' is the most primitive function in the part of the Henderson<eop>
  201. library that deals with X windows, and therefore, can be used as a very<eop>
  202. powerful tool.  It draws a Plot plt (see 'plot' function) in the given XWindow<
  203. eop>
  204. win, and on the given XScreen and XDisplay scn and dis, drawing the lines in<eo
  205. p>
  206. the foreground color.  This function allows the programmer to draw more than<eo
  207. p>
  208. one Picture to the same window.<eop>
  209. <eop>
  210. Arguments:<eop>
  211.   win - the XWindow in which to draw plt<eop>
  212.   scn - the screen which contains win<eop>
  213.   dis - the display which contains scn<eop>
  214.   fg_color - an XPixel the color of which the plt will be drawn in.  Note that<
  215. eop>
  216. <tab>this allows the programmer to draw different plt's in different colors.<eo
  217. p>
  218.   bg_color - unused, but required.<eop>
  219. --------------------------------------------------------<eop>
  220. Function: plot<eop>
  221. <eop>
  222. Type of 'plot':<eop>
  223.   plot :: Picture -<ra> VTriple -<ra> PEnv -<ra> ((Plot, PEnv) -<ra> IO()) -<ra
  224. > IO()<eop>
  225. <eop>
  226. Usage:<eop>
  227.   plot pic (a,b,c) env func<eop>
  228. <eop>
  229. The 'plot' function is needed to create a Plot which would be normally sent to<
  230. eop>
  231. a function such as sendToDraw.  'plot' converts a Picture pic into a format<eop
  232. >
  233. that sendToDraw can deal with.<eop>
  234. 'plot' also takes three vectors which specify the bounding box in which the<eop
  235. >
  236. Picture is to be drawn.  The first vector (a) specifies the upper left corner<e
  237. op>
  238. of the bounding box.  The next two vectors specify the bounding box itself,<eop
  239. >
  240. with respect to the first vector.  This allows for non-rectangular bounding<eop
  241. >
  242. boxes.  For example, the vector triple ((50,50), (100,0), (0,100)) specifies<eo
  243. p>
  244. the following bounding box:<eop>
  245. <eop>
  246.             (0,0)----------------------------------<eop>
  247.                  |<eop>
  248.                  |  (50,50)<eop>
  249.                  |     _______________ (150,0)  <eop>
  250.                  |     |             |<eop>
  251.                  |     |             |<eop>
  252.                  |     |             |<eop>
  253.                  |     |             |<eop>
  254.                  |     |             |<eop>
  255.                  |     |_____________| (150,150)<eop>
  256.                  |  (0,150)<eop>
  257. <eop>
  258. <eop>
  259. A vector triple of ((0,0), (100,300), (0,100)) would specify:<eop>
  260. <eop>
  261.             (0,0)-------------------------------------<eop>
  262.                  ||\<eop>
  263.                  || \<eop>
  264.                  ||  \<eop>
  265.           (0,100)||   \<eop>
  266.                  |\    \<eop>
  267.                  | \    \<eop>
  268.                  |  \    \<eop>
  269.                  |   \    \ (100,300)<eop>
  270.                  |    \   | <eop>
  271.                  |     \  |<eop>
  272.                  |      \ |<eop>
  273.                  |       \| (100,400)<eop>
  274. <eop>
  275. Arguments:                 <eop>
  276.   pic - the Picture to be converted<eop>
  277.   a - a vector specifying the upper left corner of the bounding box<eop>
  278. <tab>of the picture.<eop>
  279.   b - a vector understood to start at 'a' and specifying the upper edge of<eop>
  280.  
  281. <tab>the bounding box.<eop>
  282.   c - a vector understood to start at 'a' and specifying the left edge of<eop>
  283. <tab>the bounding box.<eop>
  284. --------------------------------------------------------<eop>
  285. Function: draw<eop>
  286. <eop>
  287. Type of draw:<eop>
  288.   draw :: Hostname -<ra> Picture -<ra> VTriple -<ra> HendQuartet -<ra> IO()<eop
  289. >
  290. <eop>
  291. Usage:<eop>
  292.   draw host pic (a,b,c) (m,n,p,q)<eop>
  293. <eop>
  294. 'draw' is a higher-level function than sendToDraw, and is useful to use when<eo
  295. p>
  296. the programmer wishes only to draw one Picture on the screen.  This function<eo
  297. p>
  298. does most of the work that the programmer would normally have to do when using<
  299. eop>
  300. sendToDraw.  'draw' opens a window at host with upper left coordinates m and n<
  301. eop>
  302. (on an X server that lets the user position any child window of the root<eop>
  303. window, these coordinates mean nothing), and with width p and height q.<eop>
  304. 'draw' then calls 'plot' on pic and (a,b,c) and sends the result to sendToDraw,
  305. <eop>
  306. which finally draws the picture to the window.<eop>
  307. <eop>
  308. Arguments:<eop>
  309.   host - host on which to open a display, i.e. "tucan:0"<eop>
  310.   pic - the Picture to be drawn<eop>
  311.   (a,b,c) - the vector triple specifying the bounding box to be sent to<eop>
  312. <tab>plot (see 'plot' function)<eop>
  313.   (m,n,p,q) - upper left corner x (m), upper left corner y (n), width (p),<eop>
  314.  
  315. <tab>and height (q), of window to be opened.<eop>
  316. <eop>
  317. -----------------------------------------------------------<eop>
  318. <eop>
  319. Module: SquareLimit<eop>
  320. <eop>
  321. This module is a sample user module that can be used to draw Square Limit, a wo
  322. odcut by M. C. Escher.  To draw "SquareLimit" on your host, run the dialogue:<e
  323. op>
  324. <tab>final host<eop>
  325. where 'host' is the host running X, such as "turtle:0".<eop>
  326. <eop>
  327. To draw a slightly more interesting picture, tun the dialogue:<eop>
  328. <tab>skewedfinal host<eop>
  329. and it will draw "SquareLimit" in a bounding box shaped as a diamond.<eop>
  330. <eop>
  331.  
  332. <textstream_end> 
  333.  
  334. POLY_OBJECT POLY_TEXT |  DefPolyType 
  335.  
  336. 0 DefLineWidth TRANSPARENT DefPenColor TRANSPARENT DefFillColor 1 DefIG 300 
  337. DefResolution 100 DefYScale 100 DefXScale (=default) DefPolyResId 1 
  338. DefMasterRef 
  339.  
  340. MP_CPSUCC_LINK MP_CPPRED_LINK LINK_OVERFLOW MPREF_VALID POLY_COLUMN AUTO_STREAM | | | | | 
  341. DefSLinksFlags 0 DefStreamSucc 2 DefStreamPred 3 DefTextHandle 
  342. 1440 1080 11160 1080 11160 14760 1440 14760 4 
  343. POLY_OBJECT POLY_TEXT |  (2) 0 4 TextPolygon 
  344.  
  345. BeginProfile 
  346. (Number of Pages) (5)  DefProfileString 
  347. (Language) (ENGLISH)  DefProfileString 
  348. (Version) (IslandWrite Version 2.3)  DefProfileString 
  349. (Creation Date) (gadde May 7, 1993 3:55 PM)  DefProfileString 
  350. (Text Formats) (default)  DefProfileString 
  351. (Container Formats) (default)  DefProfileString 
  352. (Page Formats) (default)  DefProfileString 
  353. (Fonts) (Courier)  DefProfileString 
  354. (Fonts) (Times-Roman)  DefProfileString 
  355. (File Path) ()  DefProfileString 
  356. (External Contents) ()  DefProfileString 
  357. (Title) ()  DefProfileString 
  358. (Status) ()  DefProfileString 
  359. (Distribution List) ()  DefProfileString 
  360. (Preparer) ()  DefProfileString 
  361. (Owner) ()  DefProfileString 
  362. (Author) ()  DefProfileString 
  363. (Superseded Documents) ()  DefProfileString 
  364. EndProfile 
  365.  
  366. pgscriptdone 
  367.